

clear
cd ""
import excel "Deployment_Master-AliCopy-June2017.xlsx", sheet("Sheet1") firstrow case(lower)

keep if country == "Peru"
keep year country region province
replace region = "Cusco" if region == "Cuzco"
replace region = "Lima Province" if province == "Lima Province"
drop if province == "Cusco"
gen deployment = 1


collapse (sum) deployment, by(region)

tempfile clear
tempfile interventioncount
save `interventioncount', replace

clear
shp2dta using "PER_adm1.shp", data(Peru_adm_data) coordinates(Peru_adm_coord) genid(ID) replace
use "Peru_adm_data.dta"
keep ISO NAME_1 ID
rename NAME_1 region
sort region
tempfile clear
tempfile map_temp
save `map_temp', replace

merge 1:1 region  using `interventioncount'   

replace deployment = . if deployment==0


spmap deployment using Peru_adm_coord, id(ID)  fcolor(Blues) ///
ndfcolor(none) mosize(*.15) ndocolor(black) ndsize(*.15 ..) ocolor(black) osize(*.15 ..) ///
legtitle() legend(title("Number of Deployments", size(3) span pos(11)) on label(1 "0") label(2 "1") label(3 "2") label(4 "3") symxsize(4) symysize(4) size(3.25)) clmethod(custom) clbreaks(0 1 2 3) gsize(5) name(mapgraphcolor, replace)

graph export "Map of Peru Deployments Color.pdf", replace

